package com.xiaohe66.web.domain.im.value;

import com.xiaohe66.common.ex.BusinessException;
import com.xiaohe66.common.value.ErrorCodeEnum;
import com.xiaohe66.web.integration.domain.IntValue;

/**
 * @author xiaohe
 * @since 2023.08.10 11:17
 */
public class MessageCategory extends IntValue {

    public static final MessageCategory SYSTEM = new MessageCategory(0);
    public static final MessageCategory BIRTH = new MessageCategory(10);

    private MessageCategory(int value) {
        super(value);
    }

    public static MessageCategory valueOf(int value) {
        return switch (value) {
            case 0 -> SYSTEM;
            case 10 -> BIRTH;
            default -> throw new BusinessException(ErrorCodeEnum.PARAM_ILLEGAL);
        };
    }
}
